package com.gw.vip.center.controller;

import com.gw.vip.center.auth.CheckToken;
import com.gw.vip.center.dto.IssuInfoDto;
import com.gw.vip.center.dto.OpenShopDto;
import com.gw.vip.center.vo.IssuInfoVo;
import com.gw.vip.center.vo.OpenShopVo;
import com.gw.vip.center.service.IssuService;
import com.gw.vip.common.log.PrintlnLog;
import com.gw.vip.common.vo.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author GW
 * @description 发行机构信息
 * @since 2022-04-24
 */
@RestController
@RequestMapping("issuInfo")
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class IssuInfoController {

    private final IssuService issuService;

    @PrintlnLog(description = "开店")
    @RequestMapping("openShop")
    @CheckToken
    public Result openShop(@RequestBody @Valid OpenShopDto dto){
        OpenShopVo vo = issuService.openShop(dto);
        return Result.success(vo);
    }

    @PrintlnLog(description = "获取机构信息")
    @RequestMapping("issuInfo")
    public Result issuInfo(@RequestBody @Valid IssuInfoDto dto){
        IssuInfoVo vo = issuService.issuInfo(dto);
        return Result.success(vo);
    }

}
